package cn.hxzy.mapper;

import cn.hxzy.pojo.Reply;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.One;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author songmengxin
 * @since 2021-08-03
 */
@Repository
public interface ReplyMapper extends BaseMapper<Reply> {

    @Select("SELECT * FROM reply where disId=#{disId}")
    @Results({
            @Result(property = "user",column ="userId",one =@One(select="cn.hxzy.mapper.UserMapper.getUserById"))
    })
    List<Reply> getReplyBydisId(String disPsarId);
    @Select("SELECT * FROM reply where replyId=#{replyId} and disId=#{disId}")
    @Results({
            @Result(property = "user",column ="userId",one =@One(select="cn.hxzy.mapper.UserMapper.getUserById"))
    })
    List<Reply> getReplyByreplyId(Integer replyId,String disId);
}
